{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "85c6348e",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "9c0dfa1a",
   "metadata": {},
   "outputs": [],
   "source": [
    "ar_1d=np.array([1,2,3,4])#参数是列表或者元组\n",
    "ar_2d=np.array(([1,2,3,4],[4,5,6,7],[7,8,9,10]))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "860d5494",
   "metadata": {},
   "source": [
    "属性property"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1ab0f79b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(3, 4)\n",
      "二维数组ar_1d:\n",
      " [[ 1  2  3  4  4  5]\n",
      " [ 6  7  7  8  9 10]]\n"
     ]
    }
   ],
   "source": [
    "#shape\n",
    "print(ar_2d.shape)\n",
    "ar_2d.shape=(2,6)\n",
    "print('二维数组ar_1d:\\n',ar_2d)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "0bae53f8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "size: 12\n"
     ]
    }
   ],
   "source": [
    "#size\n",
    "print(\"size:\",ar_2d.size)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "d9888e0c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ndim: 2\n"
     ]
    }
   ],
   "source": [
    "#ndim\n",
    "print('ndim:', ar_2d.ndim)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0ce7875a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "mining",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
